﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.DialogUI {
    import flash.events.*;
    import Engine.Managers.*;
    import flash.display.*;
    import Events.*;
    import flash.utils.*;
    import org.aswing.*;
    import Classes.*;
    import Display.MarketUI.*;
    import flash.text.*;
    import Display.aswingui.*;
    import com.zynga.skelly.util.*;

    public class ItemUnlockDialogView extends GenericDialogView {

        public function ItemUnlockDialogView(_arg1:Dictionary, _arg2:String="", _arg3:String="", _arg4:int=0, _arg5:Function=null, _arg6:String="", _arg7:int=0, _arg8:String="", _arg9:Function=null){
            super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9);
        }
        override protected function createIconPane():JPanel{
            var iconPane:* = null;
            var asset:* = null;
            var iconLoader:* = null;
            iconPane = new AssetPane();
            asset = this.m_assetDict["marketItem"];
            iconLoader = LoadingManager.load(m_icon, Curry.curry(function (_arg1:JPanel, _arg2:Event):void{
                iconPane.setAsset(iconLoader.content);
                var _local3:* = ((asset.width - iconLoader.content.width) / 2);
                var _local4:* = ((asset.height - iconLoader.content.height) / 2);
                ASwingHelper.setEasyBorder(iconPane, _local4, _local3);
                ASwingHelper.prepare(_arg1);
                _arg1.dispatchEvent(new UIEvent(UIEvent.REFRESH_DIALOG, "iconLoaded", true));
            }, this));
            var iconInnerPane:* = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER);
            ASwingHelper.setSizedBackground(iconInnerPane, this.m_assetDict["marketItem"], new Insets(20));
            iconInnerPane.append(iconPane);
            return (iconInnerPane);
        }
        override protected function createTextArea():JPanel{
            var _local2:Number;
            var _local10:JPanel;
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER, 10);
            if (((!((m_icon == null))) && (!((m_icon == ""))))){
                _local2 = setMessageTextWidth((((m_iconPos == ICON_POS_LEFT)) || ((m_iconPos == ICON_POS_RIGHT))));
                _local10 = this.createIconPane();
            } else {
                _local2 = setMessageTextWidth(false);
            };
            var _local3:Component = this.createTextComponent(_local2);
            var _local4:AssetPane = new AssetPane(m_assetDict["hr"]);
            var _local5:JPanel = this.createBuyText();
            var _local6:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER);
            _local6.appendAll(_local3, _local4, ASwingHelper.verticalStrut(20), _local5, ASwingHelper.verticalStrut(20));
            var _local7:JPanel = _local10;
            var _local8:JPanel = _local6;
            if ((((m_iconPos == ICON_POS_RIGHT)) || ((m_iconPos == ICON_POS_BOTTOM)))){
                _local7 = _local6;
                _local8 = _local10;
            };
            _local1.append(ASwingHelper.horizontalStrut(35));
            if ((((m_iconPos == ICON_POS_LEFT)) || ((m_iconPos == ICON_POS_RIGHT)))){
                if (_local7){
                    _local1.append(_local7);
                };
                if (_local8){
                    _local1.append(_local8);
                };
            };
            _local1.append(ASwingHelper.horizontalStrut(50));
            var _local9:int = _local3.getHeight();
            return (_local1);
        }
        private function createBuyText():JPanel{
            var _local1:JPanel = ASwingHelper.makeFlowJPanel(FlowLayout.LEFT);
            var _local2:String = ZLoc.t("Dialogs", "CatalogCost");
            var _local3:String = _local2.toUpperCase();
            var _local4:String = (BuyLogic.isLocked(m_assetDict["item"])) ? String(m_assetDict["item"].unlockCost) : m_assetDict["item"].cash;
            var _local5:JLabel = ASwingHelper.makeLabel(_local3, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, 14, EmbeddedArt.blueTextColor, JLabel.LEFT);
            _local1.append(_local5);
            var _local6:AssetPane = new AssetPane((new EmbeddedArt.icon_cash_big() as DisplayObject));
            _local1.append(_local6);
            var _local7:JLabel = ASwingHelper.makeLabel(_local4, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, 21, EmbeddedArt.redTextColor, JLabel.LEFT);
            _local1.append(_local7);
            return (_local1);
        }
        override protected function createTextComponent(_arg1:Number):Component{
            var _local3:Component;
            var _local6:Number;
            var _local7:Container;
            var _local2:String = TextFormatAlign.LEFT;
            var _local4:Component = ASwingHelper.makeMultilineText(m_message, _arg1, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, _local2, 18, EmbeddedArt.brownTextColor);
            var _local5:Number = 75;
            if (_local4.getHeight() < _local5){
                _local6 = ((_local5 - _local4.getHeight()) / 2);
                _local7 = ASwingHelper.makeSoftBoxJPanelVertical();
                _local7.append(ASwingHelper.verticalStrut(_local6));
                _local7.append(_local4);
                _local7.append(ASwingHelper.verticalStrut(_local6));
                _local3 = _local7;
            } else {
                _local3 = _local4;
            };
            return (_local3);
        }

    }
}//package Display.DialogUI 
